import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// import 'element-plus/theme-chalk/el-message.css'
// import 'element-plus/theme-chalk/el-message-box.css'
import 'virtual:svg-icons-register'
//全局样式
import '@/styles/index.scss'
//element-plus样式
import 'element-plus/dist/index.css'

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
//国际化
app.use(ElementPlus, {
  locale: zhCn,
})
//全局组件
import GlobalComponents from '@/components'
app.use(GlobalComponents)

//路由
import router from './router'
app.use(router)

//路由守卫
import '@/Promisstion'

//pinia
import pinia from './store'
app.use(pinia)

// 引入echarts
import Echarts from 'vue-echarts'
import * as echarts from 'echarts'
// 使用组件
app.component('ECharts', Echarts)
// 全局挂载 echarts
app.config.globalProperties.$echarts = echarts

app.mount('#app')
